<?php
header("Cache-Control: no-cache, must-revalidate");
    $name=$_GET["name"];
    $con = mysql_connect("localhost", "root", "") or die(mysql_error());
    mysql_select_db("tubetogether", $con);
    $sql="SELECT * FROM names WHERE Name <> '$name' and LoggedIn=1";
    $result = mysql_query($sql);
    $arr=array();

    while ($row=mysql_fetch_array($result)) {
        $arr[]=$row["Name"];
    }

    mysql_close($con);
    echo "<?xml version=\"1.0\"?>\n";
    echo "<participants>\n";
    foreach($arr as $a) {
        echo "<participant>$a</participant>\n";
    }
    echo "</participants>\n";
?>
